home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / gnu / hello1_3.lha / hello-1.3 / configure < prev    next >
Text File  |  1993-05-19  |  15KB  |  556 lines

  1. #!/bin/sh
  2. # Guess values for system-dependent variables and create Makefiles.
  3. # Generated automatically using autoconf.
  4. # Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
  5.  
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2, or (at your option)
  9. # any later version.
  10.  
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. # GNU General Public License for more details.
  15.  
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. # Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] [--no-create]
  21. #        [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE] [TARGET]
  22. # Ignores all args except --srcdir, --prefix, --exec-prefix, --no-create, and
  23. # --with-PACKAGE unless this script has special code to handle it.
  24.  
  25.  
  26. for arg
  27. do
  28.   # Handle --exec-prefix with a space before the argument.
  29.   if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
  30.   # Handle --host with a space before the argument.
  31.   elif test x$next_host = xyes; then next_host=
  32.   # Handle --prefix with a space before the argument.
  33.   elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
  34.   # Handle --srcdir with a space before the argument.
  35.   elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
  36.   else
  37.     case $arg in
  38.      # For backward compatibility, also recognize exact --exec_prefix.
  39.      -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*)
  40.     exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  41.      -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e)
  42.     next_exec_prefix=yes ;;
  43.  
  44.      -gas | --gas | --ga | --g) ;;
  45.  
  46.      -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
  47.      -host | --host | --hos | --ho | --h)
  48.     next_host=yes ;;
  49.  
  50.      -nfp | --nfp | --nf) ;;
  51.  
  52.      -no-create | --no-create | --no-creat | --no-crea | --no-cre | --no-cr | --no-c | --no- | --no)
  53.         no_create=1 ;;
  54.  
  55.      -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  56.     prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  57.      -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  58.     next_prefix=yes ;;
  59.  
  60.      -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
  61.     srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  62.      -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
  63.     next_srcdir=yes ;;
  64.  
  65.      -with-* | --with-*)
  66.        package=`echo $arg|sed 's/-*with-//'`
  67.        # Delete all the valid chars; see if any are left.
  68.        if test -n "`echo $package|sed 's/[-a-zA-Z0-9_]*//g'`"; then
  69.          echo "configure: $package: invalid package name" >&2; exit 1
  70.        fi
  71.        eval "with_`echo $package|sed s/-/_/g`=1" ;;
  72.  
  73.      -v | -verbose | --verbose | --verbos | --verbo | --verb | --ver | --ve | --v)
  74.        verbose=yes ;;
  75.  
  76.      *) ;;
  77.     esac
  78.   fi
  79. done
  80.  
  81. trap 'rm -f conftest* core; exit 1' 1 3 15
  82.  
  83. # Needed for some versions of `tr' so that character classes in `[]' work.
  84. if test "${LANG+set}" = "set" ; then
  85.    LANG=C
  86. fi
  87.  
  88. rm -f conftest*
  89. compile='${CC-cc} $CFLAGS $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  90.  
  91. # A filename unique to this package, relative to the directory that
  92. # configure is in, which we can look for to find out if srcdir is correct.
  93. unique_file=hello.c
  94.  
  95. # Find the source files, if location was not specified.
  96. if test -z "$srcdir"; then
  97.   srcdirdefaulted=yes
  98.   # Try the directory containing this script, then `..'.
  99.   prog=$0
  100.   confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
  101.   test "X$confdir" = "X$prog" && confdir=.
  102.   srcdir=$confdir
  103.   if test ! -r $srcdir/$unique_file; then
  104.     srcdir=..
  105.   fi
  106. fi
  107. if test ! -r $srcdir/$unique_file; then
  108.   if test x$srcdirdefaulted = xyes; then
  109.     echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
  110.   else
  111.     echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  112.   fi
  113.   exit 1
  114. fi
  115. # Preserve a srcdir of `.' to avoid automounter screwups with pwd.
  116. # But we can't avoid them for `..', to make subdirectories work.
  117. case $srcdir in
  118.   .|/*|~*) ;;
  119.   *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
  120. esac
  121.  
  122. if test -z "$CC"; then
  123.   # Extract the first word of `gcc', so it can be a program name with args.
  124.   set dummy gcc; word=$2
  125.   echo checking for $word
  126.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  127.   for dir in $PATH; do
  128.     test -z "$dir" && dir=.
  129.     if test -f $dir/$word; then
  130.       CC="gcc"
  131.       break
  132.     fi
  133.   done
  134.   IFS="$saveifs"
  135. fi
  136. test -z "$CC" && CC="cc"
  137. test -n "$CC" -a -n "$verbose" && echo "    setting CC to $CC"
  138.  
  139. # Find out if we are using GNU C, under whatever name.
  140. cat > conftest.c <<EOF
  141. #ifdef __GNUC__
  142.   yes
  143. #endif
  144. EOF
  145. ${CC-cc} -E conftest.c > conftest.out 2>&1
  146. if egrep yes conftest.out >/dev/null 2>&1; then
  147.   GCC=1 # For later tests.
  148. fi
  149. rm -f conftest*
  150.  
  151. echo checking how to run the C preprocessor
  152. if test -z "$CPP"; then
  153.   CPP='${CC-cc} -E'
  154.   cat > conftest.c <<EOF
  155. #include <stdio.h>
  156. EOF
  157. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  158. if test -z "$err"; then
  159.   :
  160. else
  161.   CPP=/lib/cpp
  162. fi
  163. rm -f conftest*
  164. fi
  165.  
  166. # Make sure to not get the incompatible SysV /etc/install and
  167. # /usr/sbin/install, which might be in PATH before a BSD-like install,
  168. # or the SunOS /usr/etc/install directory, or the AIX /bin/install,
  169. # or the AFS install, which mishandles nonexistent args, or
  170. # /usr/ucb/install on SVR4 (which tries to use the nonexistent group
  171. # `staff'.  On most BSDish systems install is in /usr/bin, not /usr/ucb
  172. # anyway).  Sigh.
  173. if test "z${INSTALL}" = "z" ; then
  174.   echo checking for install
  175.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  176.   for dir in $PATH; do
  177.     test -z "$dir" && dir=.
  178.     case $dir in
  179.     /etc|/usr/sbin|/usr/etc|/usr/afsws/bin|/usr/ucb) ;;
  180.     *)
  181.       if test -f $dir/installbsd; then
  182.     INSTALL="$dir/installbsd -c" # OSF1
  183.     INSTALL_PROGRAM='$(INSTALL)'
  184.     INSTALL_DATA='$(INSTALL) -m 644'
  185.     break
  186.       fi
  187.       if test -f $dir/install; then
  188.     if grep dspmsg $dir/install >/dev/null 2>&1; then
  189.       : # AIX
  190.     else
  191.       INSTALL="$dir/install -c"
  192.       INSTALL_PROGRAM='$(INSTALL)'
  193.       INSTALL_DATA='$(INSTALL) -m 644'
  194.       break
  195.     fi
  196.       fi
  197.       ;;
  198.     esac
  199.   done
  200.   IFS="$saveifs"
  201. fi
  202. INSTALL=${INSTALL-cp}
  203. INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
  204. INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
  205.  
  206. echo checking for ANSI C header files
  207. cat > conftest.c <<EOF
  208. #include <stdlib.h>
  209. #include <stdarg.h>
  210. #include <string.h>
  211. #include <float.h>
  212. EOF
  213. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  214. if test -z "$err"; then
  215.   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
  216. echo '#include <string.h>' > conftest.c
  217. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  218. if egrep "memchr" conftest.out >/dev/null 2>&1; then
  219.   # SGI's /bin/cc from Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
  220. cat > conftest.c <<EOF
  221. #include <ctype.h>
  222. #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
  223. #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
  224. #define XOR(e,f) (((e) && !(f)) || (!(e) && (f)))
  225. int main () { int i; for (i = 0; i < 256; i++)
  226. if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
  227. exit (0); }
  228.  
  229. EOF
  230. eval $compile
  231. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  232.   {
  233. test -n "$verbose" && \
  234. echo '    defining' STDC_HEADERS
  235. DEFS="$DEFS -DSTDC_HEADERS=1"
  236. }
  237.  
  238. fi
  239. rm -f conftest*
  240. fi
  241. rm -f conftest*
  242.  
  243. fi
  244. rm -f conftest*
  245.  
  246. for hdr in string.h fcntl.h sys/file.h
  247. do
  248. trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
  249. echo checking for ${hdr}
  250. cat > conftest.c <<EOF
  251. #include <${hdr}>
  252. EOF
  253. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  254. if test -z "$err"; then
  255.   {
  256. test -n "$verbose" && \
  257. echo '    defining' ${trhdr}
  258. DEFS="$DEFS -D${trhdr}=1"
  259. }
  260.  
  261. fi
  262. rm -f conftest*
  263. done
  264.  
  265. # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
  266. # for constant arguments.  Useless!
  267. echo checking for working alloca.h
  268. cat > conftest.c <<EOF
  269. #include <alloca.h>
  270. int main() { exit(0); }
  271. int t() { char *p = alloca(2 * sizeof(int)); }
  272. EOF
  273. if eval $compile; then
  274.   {
  275. test -n "$verbose" && \
  276. echo '    defining' HAVE_ALLOCA_H
  277. DEFS="$DEFS -DHAVE_ALLOCA_H=1"
  278. }
  279.  
  280. fi
  281. rm -f conftest*
  282.  
  283. decl="#ifdef __GNUC__
  284. #define alloca __builtin_alloca
  285. #else
  286. #if HAVE_ALLOCA_H
  287. #include <alloca.h>
  288. #else
  289. #ifdef _AIX
  290.  #pragma alloca
  291. #else
  292. char *alloca ();
  293. #endif
  294. #endif
  295. #endif
  296. "
  297. echo checking for alloca
  298. cat > conftest.c <<EOF
  299. $decl
  300. int main() { exit(0); }
  301. int t() { char *p = (char *) alloca(1); }
  302. EOF
  303. if eval $compile; then
  304.   :
  305. else
  306.   alloca_missing=1
  307. cat > conftest.c <<EOF
  308.  
  309. #if defined(CRAY) && ! defined(CRAY2)
  310. winnitude
  311. #else
  312. lossage
  313. #endif
  314.  
  315. EOF
  316. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  317. if egrep "winnitude" conftest.out >/dev/null 2>&1; then
  318.   echo checking for _getb67
  319. cat > conftest.c <<EOF
  320. #include <ctype.h>
  321. int main() { exit(0); }
  322. int t() { 
  323. /* The GNU C library defines this for functions which it implements
  324.     to always fail with ENOSYS.  Some functions are actually named
  325.     something starting with __ and the normal name is an alias.  */
  326. #if defined (__stub__getb67) || defined (__stub____getb67)
  327. choke me
  328. #else
  329. /* Override any gcc2 internal prototype to avoid an error.  */
  330. extern char _getb67(); _getb67();
  331. #endif
  332.  }
  333. EOF
  334. if eval $compile; then
  335.   {
  336. test -n "$verbose" && \
  337. echo '    defining' CRAY_STACKSEG_END to be '_getb67'
  338. DEFS="$DEFS -DCRAY_STACKSEG_END=_getb67"
  339. }
  340.  
  341. else
  342.   echo checking for GETB67
  343. cat > conftest.c <<EOF
  344. #include <ctype.h>
  345. int main() { exit(0); }
  346. int t() { 
  347. /* The GNU C library defines this for functions which it implements
  348.     to always fail with ENOSYS.  Some functions are actually named
  349.     something starting with __ and the normal name is an alias.  */
  350. #if defined (__stub_GETB67) || defined (__stub___GETB67)
  351. choke me
  352. #else
  353. /* Override any gcc2 internal prototype to avoid an error.  */
  354. extern char GETB67(); GETB67();
  355. #endif
  356.  }
  357. EOF
  358. if eval $compile; then
  359.   {
  360. test -n "$verbose" && \
  361. echo '    defining' CRAY_STACKSEG_END to be 'GETB67'
  362. DEFS="$DEFS -DCRAY_STACKSEG_END=GETB67"
  363. }
  364.  
  365. else
  366.   echo checking for getb67
  367. cat > conftest.c <<EOF
  368. #include <ctype.h>
  369. int main() { exit(0); }
  370. int t() { 
  371. /* The GNU C library defines this for functions which it implements
  372.     to always fail with ENOSYS.  Some functions are actually named
  373.     something starting with __ and the normal name is an alias.  */
  374. #if defined (__stub_getb67) || defined (__stub___getb67)
  375. choke me
  376. #else
  377. /* Override any gcc2 internal prototype to avoid an error.  */
  378. extern char getb67(); getb67();
  379. #endif
  380.  }
  381. EOF
  382. if eval $compile; then
  383.   {
  384. test -n "$verbose" && \
  385. echo '    defining' CRAY_STACKSEG_END to be 'getb67'
  386. DEFS="$DEFS -DCRAY_STACKSEG_END=getb67"
  387. }
  388.  
  389. fi
  390. rm -f conftest*
  391.  
  392. fi
  393. rm -f conftest*
  394.  
  395. fi
  396. rm -f conftest*
  397.  
  398. fi
  399. rm -f conftest*
  400.  
  401.  
  402. fi
  403. rm -f conftest*
  404.  
  405. if test -n "$alloca_missing"; then
  406.   # The SVR3 libPW and SVR4 libucb both contain incompatible functions
  407.   # that cause trouble.  Some versions do not even contain alloca or
  408.   # contain a buggy version.  If you still want to use their alloca,
  409.   # use ar to extract alloca.o from them instead of compiling alloca.c.
  410.   ALLOCA=alloca.o
  411.  
  412.   echo 'checking stack direction for C alloca'
  413.   echo checking whether cross-compiling
  414. # If we cannot run a trivial program, we must be cross compiling.
  415. cat > conftest.c <<EOF
  416. main(){exit(0);}
  417. EOF
  418. eval $compile
  419. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  420.   :
  421. else
  422.   cross_compiling=1
  423. fi
  424. rm -f conftest*
  425.  
  426. if test -n "$cross_compiling"
  427. then
  428.   {
  429. test -n "$verbose" && \
  430. echo '    defining' STACK_DIRECTION to be '0'
  431. DEFS="$DEFS -DSTACK_DIRECTION=0"
  432. }
  433.  
  434. else
  435. cat > conftest.c <<EOF
  436. find_stack_direction ()
  437. {
  438.   static char *addr = 0;
  439.   auto char dummy;
  440.   if (addr == 0)
  441.     {
  442.       addr = &dummy;
  443.       find_stack_direction ();
  444.     }
  445.   else
  446.     return (&dummy > addr) ? 1 : -1;
  447. }
  448. main ()
  449. {
  450.   exit (find_stack_direction() < 0);
  451. }
  452. EOF
  453. eval $compile
  454. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  455.   {
  456. test -n "$verbose" && \
  457. echo '    defining' STACK_DIRECTION to be '1'
  458. DEFS="$DEFS -DSTACK_DIRECTION=1"
  459. }
  460.  
  461. else
  462.   {
  463. test -n "$verbose" && \
  464. echo '    defining' STACK_DIRECTION to be '-1'
  465. DEFS="$DEFS -DSTACK_DIRECTION=-1"
  466. }
  467.  
  468. fi
  469. fi
  470. rm -f conftest*
  471. fi
  472.  
  473. if test -n "$prefix"; then
  474.   test -z "$exec_prefix" && exec_prefix='${prefix}'
  475.   prsub="s%^prefix\\([     ]*\\)=\\([     ]*\\).*$%prefix\\1=\\2$prefix%"
  476. fi
  477. if test -n "$exec_prefix"; then
  478.   prsub="$prsub
  479. s%^exec_prefix\\([     ]*\\)=\\([     ]*\\).*$%\
  480. exec_prefix\\1=\\2$exec_prefix%"
  481. fi
  482. DEFS="`echo \"$DEFS\" | sed 's%[&\\\]%\\\&%g'`"
  483.  
  484. trap 'rm -f config.status; exit 1' 1 3 15
  485. echo creating config.status
  486. rm -f config.status
  487. cat > config.status <<EOF
  488. #!/bin/sh
  489. # Generated automatically by configure.
  490. # Run this file to recreate the current configuration.
  491. # This directory was configured as follows,
  492. # on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
  493. #
  494. # $0 $*
  495.  
  496. for arg
  497. do
  498.   case "\$arg" in
  499.     -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  500.     exec /bin/sh $0 $* ;;
  501.     *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
  502.   esac
  503. done
  504.  
  505. trap 'rm -f Makefile; exit 1' 1 3 15
  506. CC='$CC'
  507. CPP='$CPP'
  508. INSTALL='$INSTALL'
  509. INSTALL_PROGRAM='$INSTALL_PROGRAM'
  510. INSTALL_DATA='$INSTALL_DATA'
  511. ALLOCA='$ALLOCA'
  512. LIBS='$LIBS'
  513. srcdir='$srcdir'
  514. DEFS='$DEFS'
  515. prefix='$prefix'
  516. exec_prefix='$exec_prefix'
  517. prsub='$prsub'
  518. EOF
  519. cat >> config.status <<\EOF
  520.  
  521. top_srcdir=$srcdir
  522.  
  523. # Allow make-time overrides of the generated file list.
  524. test -n "$gen_files" || gen_files="Makefile"
  525.  
  526. for file in .. $gen_files; do if [ "x$file" != "x.." ]; then
  527.   srcdir=$top_srcdir
  528.   # Remove last slash and all that follows it.  Not all systems have dirname.
  529.   dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  530.   if test "$dir" != "$file"; then
  531.     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  532.     test ! -d $dir && mkdir $dir
  533.   fi
  534.   echo creating $file
  535.   rm -f $file
  536.   echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
  537.   sed -e "
  538. $prsub
  539. s%@CC@%$CC%g
  540. s%@CPP@%$CPP%g
  541. s%@INSTALL@%$INSTALL%g
  542. s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
  543. s%@INSTALL_DATA@%$INSTALL_DATA%g
  544. s%@ALLOCA@%$ALLOCA%g
  545. s%@LIBS@%$LIBS%g
  546. s%@srcdir@%$srcdir%g
  547. s%@DEFS@%$DEFS%
  548. " $top_srcdir/${file}.in >> $file
  549. fi; done
  550.  
  551. exit 0
  552. EOF
  553. chmod +x config.status
  554. test -n "$no_create" || ./config.status
  555.  
  556.